Integrate Service
Integrate service is the server that manages and executes the integration of Gcalls with external systems. This is the middle ground between Gcalls and external systems
The integration of Gcalls
- hubspot
- SMS: nhanh, vietguy, FPT sms, SAPO, MIO
- Other integration: bitrix24, zendesk, infobip, freshsales
I. Functionality
- Call the api of the external system
- Receive request api from sms outbound webhook
II. Packages
1. Dependencies
- @vonage/server-sdk - This is the Node.JS Server SDK for Vonage APIs. To use it you will need a Vonage account. Sign up for free at vonage.com Vonage
- Await-to-js - Async await wrapper for easy error handling without try-catch Await-to-js
- Aws-sdk - AWS SDK for JavaScript in the browser and Node.js Aws-sdk
- Axios - Promise based HTTP client for the browser and node.js Axios
- Babel-core - Babel compiler core. Babel-core
- Babel-plugin-transform-object-rest-spread - Compile object rest and spread to ES5 Babel-plugin-transform-object-rest-spread
- Babel-polyfill - Provides polyfills necessary for a full ES2015+ environment Babel-polyfill
- Babel-preset-env - A Babel preset for each environment. Babel-preset-env
- Babel-register - babel require hook Babel-register
- Bluebird - Full featured Promises/A+ implementation with exceptionally good performance Bluebird
- Body-parser - Node.js body parsing middleware Body-parser
- Cors - Node.js CORS middleware Cors
- Cron - Cron jobs for your node Cron
- Crypto-js - JavaScript library of crypto standards. Crypto-js
- Dataobject-parser - Parse data object Dataobject-parser
- Dotenv - Loads environment variables from .env file Dotenv
- Ejs - Embedded JavaScript templates Ejs
- Express-session - Simple session middleware for Express Express-session
- Express - Fast, unopinionated, minimalist web framework Express
- Fs - Node.js File System module Fs
- Mongodb - The official MongoDB driver for Node.js Mongodb
- Morgan - HTTP request logger middleware for node.js Morgan
- Node-schedule - A cron-like and not-cron-like job scheduler for Node. Node-schedule
- Nodemailer - Send e-mails from Node.js Nodemailer
- Objects-to-csv - Convert objects into CSV format Objects-to-csv
- Path - Node.JS path module Path
- Qs - A querystring parsing and stringifying library with some added security. Qs
- Redis - Redis client for Node.js Redis
- Serve-favicon - Node.js middleware for serving a favicon Serve-favicon
2. Dev dependencies
III. Database
1. ERD
2. Database schema
Database schema
endpoint store information integration
| Field | Type | Description |
|---|---|---|
| _id | string | |
| name | string | integration name |
| integration | string | |
| description | description integration | |
| url | string | url api of external system |
| method | string | method of api |
| parameters | object | required parameters to call the api of the external systems like api key, id,... |
IV. Source tree
.
├── app.js
├── .babelrc
├── config
│ ├── access.js
│ ├── admin.js
│ ├── developer.js
│ ├── fpt.js
│ ├── host.js
│ ├── mio.js
│ ├── mongodb.js
│ ├── nhanh.js
│ ├── port.js
│ └── redis.js
├── Dockerfile
├── .dockerignore
├── .env
├── errorList.json
├── favicon.ico
├── .gitignore
├── index.js
├── integration
│ └── salesforce
│ ├── index.js
│ └── utils.js
├── lib
│ ├── access.js
│ ├── fpt.js
│ ├── hubspot.js
│ ├── integrator.js
│ ├── mio.js
│ ├── nhanh.js
│ ├── redis.js
│ ├── restore3rd.js
│ ├── schedule.js
│ ├── sharedFunction.js
│ └── vietguy.js
├── middleware
│ └── auth.js
├── model
│ └── endpoint.js
├── package.json
├── package-lock.json
├── route
│ ├── api
│ │ ├── fpt.js
│ │ ├── hubspot.js
│ │ ├── integrator.js
│ │ ├── mio.js
│ │ ├── nexmo.js
│ │ ├── nhanh.js
│ │ ├── sapo.js
│ │ ├── trigger.js
│ │ └── vietguy.js
│ ├── authorize.js
│ ├── index.js
│ └── third-party
│ ├── fpt.js
│ ├── hubspot.js
│ ├── integrator.js
│ ├── mio.js
│ ├── nexmo.js
│ ├── nhanh.js
│ ├── sapo.js
│ └── vietguy.js
├── ../static
│ ├── js
│ │ ├── authorize.js
│ │ ├── endpoint.js
│ │ ├── fpt.js
│ │ ├── hubspot.js
│ │ ├── integrator.js
│ │ ├── mio.js
│ │ ├── nexmo.js
│ │ ├── nhanh.js
│ │ ├── sapo.js
│ │ ├── signin.js
│ │ └── vietguy.js
│ └── material-kit
│ └── assets
├── template
│ └── unsavedContact.html
└── view
├── authorize.ejs
├── endpoint.ejs
├── fpt.ejs
├── hubspot.ejs
├── index.ejs
├── integrator.ejs
├── mio.ejs
├── nexmo.ejs
├── nhanh.ejs
├── plugins.ejs
├── sapo.ejs
├── signin.ejs
└── vietguy.ejs
IV. Installation
- Clone project:
git clone https://gitlab.com/gcalls-opensource/gcallsmiddle.git
- Change dir into integrateService folder to run backend
cd integrateService
- Install utility modules:
npm install
Start server:
run in development
npm run devrun in production
npm install -g pm2
npm start
V. Endpoints
Please visit Here for more details